"""
# -*- coding: utf-8 -*-
# @Time    : 2023/5/27 10:43
# @Author  : 王摇摆
# @FileName: DANWEIGEN.py
# @Software: PyCharm
# @Blog    ：https://blog.csdn.net/weixin_44943389?type=blog
"""
import numpy as np
import matplotlib.pyplot as plt

# 生成角度值
theta = np.linspace(0, 2 * np.pi, 100)

# 计算单位根圆上的点
x = np.cos(theta)
y = np.sin(theta)

# 绘制单位根圆图
plt.plot(x, y)
plt.axhline(0, color='black', linestyle='--')  # 实轴
plt.axvline(0, color='black', linestyle='--')  # 虚轴

# 等分单位圆并标记关键点
for i in range(8):
    angle = i * np.pi / 4
    px = np.cos(angle)
    py = np.sin(angle)
    plt.plot([0, px], [0, py], 'r--')
    plt.plot(px, py, 'ro')
    plt.annotate(f'({px:.2f}, {py:.2f})', (px, py), xytext=(px + 0.1, py + 0.1), color='red')

plt.xlabel('Real')
plt.ylabel('Imaginary')
plt.title('Unit Circle Plot')
plt.grid(True)
plt.axis('equal')  # 设置坐标轴比例一致
plt.show()

